/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.cmp.screens;

import com.cmp.arena.Arena;
import com.jme3.app.Application;
import com.jme3.app.SimpleApplication;
import com.jme3.app.state.AbstractAppState;
import com.jme3.app.state.AppStateManager;
import com.jme3.scene.Node;
import de.lessvoid.nifty.Nifty;
import de.lessvoid.nifty.screen.Screen;
import de.lessvoid.nifty.screen.ScreenController;

/**
 * Bundles nodes for the arena and UI stuff.
 * @author krummer
 */
public class TestState extends AbstractAppState implements ScreenController {
    private SimpleApplication app;
    private Node node;
    
    @Override
    public void initialize(AppStateManager stateManager, Application app) {
        super.initialize(stateManager, app);
        this.app = (SimpleApplication) app;
       
        this.node = new Node("TestState");
        this.app.getRootNode().attachChild(node);
        
        Arena arena = new Arena();
        app.getStateManager().attach(arena);
        this.node.attachChild(arena.getMapNode());
    }
    
    @Override
    public void cleanup() {
        super.cleanup();
        //TODO: clean up your mess!
        
    }
    
    @Override
    public void setEnabled(boolean enabled) {
        super.setEnabled(enabled);
        if(enabled) {
            app.getRootNode().attachChild(node);
        } else {
            app.getRootNode().detachChild(node);
        }
    }

    public void bind(Nifty nifty, Screen screen) {

    }

    public void onStartScreen() {

    }

    public void onEndScreen() {

    }
}
